package storage.tx.recovery;

import storage.log.BasicLogRecord;


class RollbackRecord implements LogRecord {
   private int txnum;
   
 
   public RollbackRecord(int txnum) {
      this.txnum = txnum;
   }
   
  
   public RollbackRecord(BasicLogRecord rec) {
      txnum = rec.nextInt();
   }
   
 
   public int writeToLog() {
      Object[] rec = new Object[] {ROLLBACK, txnum};
      return logMgr.append(rec);
   }
   
   public int op() {
      return ROLLBACK;
   }
   
   public int txNumber() {
      return txnum;
   }
   
   
   public void undo(int txnum) {}
   
   public String toString() {
      return "<ROLLBACK " + txnum + ">";
   }
}
